<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />

  <title>Class: SQLValue</title>

  <link rel="stylesheet" href="./rdoc.css" type="text/css" media="screen" />

  <script src="./js/jquery.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
  <script src="./js/darkfish.js" type="text/javascript" charset="utf-8"></script>

</head>
<body id="top" class="class">

  <div id="metadata">
    <div id="home-metadata">
      <div id="home-section" class="section">
        <h3 class="section-header">
          <a href="./index.html">Home</a>
          <a href="./index.html#classes">Classes</a>
          <a href="./index.html#methods">Methods</a>
        </h3>
      </div>
    </div>

    <div id="file-metadata">
      <div id="file-list-section" class="section">
        <h3 class="section-header">In Files</h3>
        <div class="section-body">
          <ul>
          
            <li><a href="./lib/sqlobject_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
              class="thickbox" title="lib/sqlobject.rb">lib/sqlobject.rb</a></li>
          
          </ul>
        </div>
      </div>

      
    </div>

    <div id="class-metadata">
      
      <!-- Parent Class -->
      <div id="parent-class-section" class="section">
        <h3 class="section-header">Parent</h3>
        
        <p class="link"><a href="SQLObject.html">SQLObject</a></p>
        
      </div>
      

      

      

      
      <!-- Method Quickref -->
      <div id="method-list-section" class="section">
        <h3 class="section-header">Methods</h3>
        <ul class="link-list">
          
          <li><a href="#method-c-new">::new</a></li>
          
          <li><a href="#method-i-_escape">#_escape</a></li>
          
          <li><a href="#method-i-_quoteString">#_quoteString</a></li>
          
          <li><a href="#method-i-to_s">#to_s</a></li>
          
        </ul>
      </div>
      

      
    </div>

    <div id="project-metadata">
      
      
      <div id="fileindex-section" class="section project-section">
        <h3 class="section-header">Files</h3>
        <ul>
        
          <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
        
        </ul>
      </div>
      

      <div id="classindex-section" class="section project-section">
        <h3 class="section-header">Class/Module Index
          <span class="search-toggle"><img src="./images/find.png"
            height="16" width="16" alt="[+]"
            title="show/hide quicksearch" /></span></h3>
        <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
        <fieldset>
          <legend>Quicksearch</legend>
          <input type="text" name="quicksearch" value=""
            class="quicksearch-field" />
        </fieldset>
        </form>

        <ul class="link-list">
        
          <li><a href="./SQLConstructor.html">SQLConstructor</a></li>
        
          <li><a href="./SQLConstructor/BasicDelete.html">SQLConstructor::BasicDelete</a></li>
        
          <li><a href="./SQLConstructor/BasicDelete_mysql.html">SQLConstructor::BasicDelete_mysql</a></li>
        
          <li><a href="./SQLConstructor/BasicInsert.html">SQLConstructor::BasicInsert</a></li>
        
          <li><a href="./SQLConstructor/BasicInsert_mysql.html">SQLConstructor::BasicInsert_mysql</a></li>
        
          <li><a href="./SQLConstructor/BasicJoin.html">SQLConstructor::BasicJoin</a></li>
        
          <li><a href="./SQLConstructor/BasicJoin_mysql.html">SQLConstructor::BasicJoin_mysql</a></li>
        
          <li><a href="./SQLConstructor/BasicSelect.html">SQLConstructor::BasicSelect</a></li>
        
          <li><a href="./SQLConstructor/BasicSelect_example.html">SQLConstructor::BasicSelect_example</a></li>
        
          <li><a href="./SQLConstructor/BasicSelect_mysql.html">SQLConstructor::BasicSelect_mysql</a></li>
        
          <li><a href="./SQLConstructor/BasicUnion.html">SQLConstructor::BasicUnion</a></li>
        
          <li><a href="./SQLConstructor/BasicUpdate.html">SQLConstructor::BasicUpdate</a></li>
        
          <li><a href="./SQLConstructor/BasicUpdate_mysql.html">SQLConstructor::BasicUpdate_mysql</a></li>
        
          <li><a href="./SQLConstructor/GenericQuery.html">SQLConstructor::GenericQuery</a></li>
        
          <li><a href="./SQLConstructor/QAttr.html">SQLConstructor::QAttr</a></li>
        
          <li><a href="./SQLExporter.html">SQLExporter</a></li>
        
          <li><a href="./SQLExporter/Exporter_generic.html">SQLExporter::Exporter_generic</a></li>
        
          <li><a href="./SQLExporter/Exporter_mysql.html">SQLExporter::Exporter_mysql</a></li>
        
          <li><a href="./SQLConditional.html">SQLConditional</a></li>
        
          <li><a href="./SQLConditional/BasicCond.html">SQLConditional::BasicCond</a></li>
        
          <li><a href="./Object.html">Object</a></li>
        
          <li><a href="./SQLAliasedList.html">SQLAliasedList</a></li>
        
          <li><a href="./SQLColumn.html">SQLColumn</a></li>
        
          <li><a href="./SQLCondList.html">SQLCondList</a></li>
        
          <li><a href="./SQLConstructorTest.html">SQLConstructorTest</a></li>
        
          <li><a href="./SQLObject.html">SQLObject</a></li>
        
          <li><a href="./SQLValList.html">SQLValList</a></li>
        
          <li><a href="./SQLValue.html">SQLValue</a></li>
        
        </ul>
        <div id="no-class-search-results" style="display: none;">No matching classes.</div>
      </div>

      
    </div>
  </div>

  <div id="documentation">
    <h1 class="class">SQLValue</h1>

    <div id="description" class="description">
      
<p>Class representing SQL scalar values</p>

    </div><!-- description -->

    
    
    
    <div id="5Buntitled-5D" class="documentation-section">
      

      

      

      

      <!-- Methods -->
      
      <div id="public-class-method-details" class="method-section section">
        <h3 class="section-header">Public Class Methods</h3>

      
        <div id="new-method" class="method-detail ">
          <a name="method-c-new"></a>

          
          <div class="method-heading">
            <span class="method-name">new</span><span
              class="method-args">( val = nil )</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="new-source">
<pre>
<span class="ruby-comment"># File lib/sqlobject.rb, line 129</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span> ( <span class="ruby-identifier">val</span> = <span class="ruby-keyword">nil</span> )
    <span class="ruby-ivar">@value</span> = <span class="ruby-identifier">val</span>.<span class="ruby-identifier">is_a?</span>( <span class="ruby-constant">SQLValue</span> )  <span class="ruby-operator">?</span>  <span class="ruby-identifier">val</span>.<span class="ruby-identifier">value</span>  <span class="ruby-operator">:</span>  <span class="ruby-identifier">_escape</span>( <span class="ruby-identifier">val</span> )
<span class="ruby-keyword">end</span></pre>
            </div><!-- new-source -->
            
          </div>

          

          
        </div><!-- new-method -->

      
      </div><!-- public-class-method-details -->
    
      <div id="public-instance-method-details" class="method-section section">
        <h3 class="section-header">Public Instance Methods</h3>

      
        <div id="to_s-method" class="method-detail ">
          <a name="method-i-to_s"></a>

          
          <div class="method-heading">
            <span class="method-name">to_s</span><span
              class="method-args">()</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            
            

            
            <div class="method-source-code" id="to_s-source">
<pre>
<span class="ruby-comment"># File lib/sqlobject.rb, line 134</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">to_s</span>
    <span class="ruby-ivar">@value</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- to_s-source -->
            
          </div>

          

          
        </div><!-- to_s-method -->

      
      </div><!-- public-instance-method-details -->
    
      <div id="private-instance-method-details" class="method-section section">
        <h3 class="section-header">Private Instance Methods</h3>

      
        <div id="_escape-method" class="method-detail ">
          <a name="method-i-_escape"></a>

          
          <div class="method-heading">
            <span class="method-name">_escape</span><span
              class="method-args">( val )</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>DERIVED FROM <a
href="https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb">github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb</a></p>
            

            
            <div class="method-source-code" id="_escape-source">
<pre>
<span class="ruby-comment"># File lib/sqlobject.rb, line 143</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">_escape</span> ( <span class="ruby-identifier">val</span> )
    <span class="ruby-keyword">case</span> <span class="ruby-identifier">val</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">String</span>     <span class="ruby-keyword">then</span> <span class="ruby-node">&quot;'#{_quoteString(val.to_s)}'&quot;</span>
        <span class="ruby-keyword">when</span> <span class="ruby-keyword">true</span>       <span class="ruby-keyword">then</span> <span class="ruby-string">'TRUE'</span>
        <span class="ruby-keyword">when</span> <span class="ruby-keyword">false</span>      <span class="ruby-keyword">then</span> <span class="ruby-string">'FALSE'</span>
        <span class="ruby-keyword">when</span> <span class="ruby-keyword">nil</span>        <span class="ruby-keyword">then</span> <span class="ruby-string">&quot;NULL&quot;</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">Numeric</span>, <span class="ruby-constant">Time</span> <span class="ruby-keyword">then</span> <span class="ruby-identifier">val</span>.<span class="ruby-identifier">to_s</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">Symbol</span>     <span class="ruby-keyword">then</span> <span class="ruby-node">&quot;'#{_quoteString(val.to_s)}'&quot;</span>
        <span class="ruby-keyword">when</span> <span class="ruby-constant">Class</span>      <span class="ruby-keyword">then</span> <span class="ruby-node">&quot;'#{val.to_s}'&quot;</span>
        <span class="ruby-keyword">else</span>
            <span class="ruby-node">&quot;'#{quoteString( val.to_s )}'&quot;</span>
    <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- _escape-source -->
            
          </div>

          

          
        </div><!-- _escape-method -->

      
        <div id="_quoteString-method" class="method-detail ">
          <a name="method-i-_quoteString"></a>

          
          <div class="method-heading">
            <span class="method-name">_quoteString</span><span
              class="method-args">( str )</span>
            <span class="method-click-advice">click to toggle source</span>
          </div>
          

          <div class="method-description">
            
            <p>FROM <a
href="https://github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb">github.com/rails/rails/blob/master/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb</a>
Quotes a string, escaping any ‘ (single quote) and \ (backslash)
characters.</p>
            

            
            <div class="method-source-code" id="_quoteString-source">
<pre>
<span class="ruby-comment"># File lib/sqlobject.rb, line 162</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier">_quoteString</span> ( <span class="ruby-identifier">str</span> )
    <span class="ruby-identifier">str</span>.<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp">/\\/</span>, <span class="ruby-string">'\&amp;\&amp;'</span> ).<span class="ruby-identifier">gsub</span>( <span class="ruby-regexp">/'/</span>, <span class="ruby-string">&quot;''&quot;</span> ) <span class="ruby-comment"># ' (for ruby-mode)</span>
<span class="ruby-keyword">end</span></pre>
            </div><!-- _quoteString-source -->
            
          </div>

          

          
        </div><!-- _quoteString-method -->

      
      </div><!-- private-instance-method-details -->
    
    </div><!-- 5Buntitled-5D -->
  

  </div><!-- documentation -->

  <div id="validator-badges">
    <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
    <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
      Rdoc Generator</a> 2</small>.</p>
  </div>

</body>
</html>

